<%@ page contentType="text/html; charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/tlds/struts-html.tld"  prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld"  prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/custom-html.tld" prefix="chtml" %>

<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Collection" %>
<%@ page import="com.erp.app.util.web.WebUtil" %>
<%@ page import="com.erp.app.common.ProjectConstants" %>
<%@ page import="com.erp.framework.util.CommonUtil" %>
<%@ page import="com.erp.app.report.genericInquiry.inquiryMaster.beans.*" %>
<%@ page import="com.erp.app.report.genericInquiry.inquiryDisplay.beans.vo.*" %>
<%@ page import="com.erp.app.report.genericInquiry.inquiryOutput.beans.vo.*" %>
<%@ page import="com.erp.app.report.genericInquiry.*" %>
<%@ page import="com.erp.app.report.genericInquiry.GenericInquiryConstants" %>

<jsp:useBean id="genericInquirySearchForm" scope="session" type="GenericInquirySearchForm" />
<bean:define id="masterVO" name="genericInquirySearchForm" property="genericInquiryMasterVO" type="GenericInquiryMasterVO"/>
<%	Collection displayList = masterVO.getLocalChilds(InquiryDisplayVO.class);
	pageContext.setAttribute("displayList", displayList); 

//	System.out.println("************************ RESULT JSP, sizeof genericInquirySearchForm.getResultList()=" + genericInquirySearchForm.getResultList().size());

%>
<logic:iterate id="result" name="genericInquirySearchForm" property="resultList" indexId="idx" length="<%=String.valueOf(ProjectConstants.MAX_DISPLAY)%>" offset="<%=String.valueOf(genericInquirySearchForm.getSidx())%>" type="InquiryOutputVO">
<tr <%=(idx.intValue()%2 == 0)? "class=grid_result1": "class=grid_result2"%>> 
	<logic:iterate id="display" name="displayList" indexId="dIdx" type="InquiryDisplayVO">
		<%	String dispCode = display.getDispCode(); 
			String vAlign = CommonUtil.nullToString(display.getVertAlign());
			String hAlign = CommonUtil.nullToString(display.getHorizAlign());
			String hiddenFlag = CommonUtil.nullToString(display.getHiddenFlag());
			String style= CommonUtil.isEmpty(vAlign) ? "" : "vertical-align:" + vAlign + ";";
			style += CommonUtil.isEmpty(hAlign) ? "" : "text-align:" + hAlign;
			int underscore_idx = dispCode.indexOf("_");
			String displayColumn = "field[" + dIdx + "]";
			boolean isDisplayURL = GenericInquiryConstants.YES.equals(display.getDispURL());
		%>
		<td class="grid_outline" <%=hiddenFlag.equals(GenericInquiryConstants.FLAG_HIDDEN) ? "id=\"" + GenericInquiryConstants.ID_TAGGED_HIDDEN + "\"" : ""%> style="<%=style%>">
			<%	if (isDisplayURL) { %>
				<a href="javascript:void(0)" onclick="redirect('<%=result.getURL()%>'); return false;">
			<%	} %>
				<bean:write name="result" property="<%= displayColumn %>"/>&nbsp;
			<%	if (isDisplayURL) { %>
				</a>
			<%	} %>
		</td>
	</logic:iterate>
</tr>
</logic:iterate>